<%@ page import="com.fs.cv.pojo.pojodao.User" %>
<!DOCTYPE html>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="pragma" content="no-cache"/>
    <meta name="renderer" content="webkit">
    <title>教务管理系统</title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/style.css?v=4.1.0" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
<div id="wrapper">
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="nav-close"><i class="fa fa-times-circle"></i>
        </div>
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <span><img id="headI" alt="image" style="height: 64px;width: 65px" class="img-circle"
                                   src="${pageContext.request.contextPath}/user/getHeadImage"/></span>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                               <span class="block m-t-xs"><strong class="font-bold">${user.userNickName}</strong></span>
                                <span class="text-muted text-xs block">超级管理员<b class="caret"></b></span>
                                </span>
                        </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <li><a class="J_menuItem" onclick="changeHeadImage()" href="">修改头像</a>
                            </li>
                            <li><a class="J_menuItem" onclick="notice(0)" href="">个人资料</a>
                            </li>
                            <li><a class="J_menuItem" onclick="notice(1)" href="">联系我们</a>
                            </li>
                            <li><a class="J_menuItem" onclick="notice(2)" href="">信箱</a>
                            </li>
                            <li class="divider"></li>
                            <li><a href="${pageContext.request.contextPath}/page/logout">退出</a>
                            </li>
                        </ul>
                    </div>
                    <div class="logo-element">教务管理系统
                    </div>
                </li>
                <shiro:hasRole name="任课教师">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/scoreData"><i
                                class="fa fa-bar-chart"></i>成绩管理</a>
                            <%-- <ul class="nav nav-second-level">
                                 <li>
                                     <a class="J_menuItem" href="${pageContext.request.contextPath}/page/studentScore">成绩管理</a>
                                 </li>
                             </ul>--%>
                    </li>
                </shiro:hasRole>
                <shiro:hasRole name="班主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/studentInfo"><i
                                class="fa fa-info-circle"></i></i>学生信息管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                        </a>
                    </li>
                </shiro:hasRole>

                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/classroomInfo"><i
                                class="fa fa-bank"></i>教室管理</a>
                            <%--消息提醒个数--%>
                            <%--<span class="label label-warning pull-right">16</span>--%>
                        </a>
                    </li>


                <shiro:hasRole name="班主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/absence"><i
                                class="fa fa-credit-card"></i>考勤管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                    </li>
                </shiro:hasRole>
                <shiro:hasRole name="教务主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/teacherInfo"><i
                                class="fa fa-info-circle"></i> 教师信息管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                    </li>
                </shiro:hasRole>
                <shiro:hasRole name="教务主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/courseInfo"><i
                                class="fa fa-clone"></i>课程信息管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                    </li>
                </shiro:hasRole>
                <shiro:hasRole name="教务主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/classInfo"><i
                                class="fa fa-mortar-board"></i> 班级信息管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                    </li>
                </shiro:hasRole>
                <shiro:hasAnyRoles name="任课教师,班主任,教务主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/recordInfo"><i
                                class="fa fa-table"></i> 授课信息管理</a>
                    </li>
                </shiro:hasAnyRoles>
                <shiro:hasRole name="教务主任">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/departmentInfo"><i
                                class="fa fa-institution"></i> 院系管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                    </li>
                </shiro:hasRole>
                <shiro:hasRole name="管理员">
                    <li>
                        <a class="J_menuItem" href="${pageContext.request.contextPath}/page/userInfo"><i
                                class="fa fa-user"></i>用户管理</a>
                            <%--下拉箭头--%>
                            <%--<span class="fa arrow"></span>--%>
                    </li>
                </shiro:hasRole>
            </ul>
        </div>
    </nav>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <%--顶部搜索框--%>
                <div class="navbar-header">
                    <div style="float: left">
                        <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#">
                            <i class="fa fa-bars"></i>
                        </a>
                    </div>
                    <marquee direction=left behavior=scroll loop=3 scrollamount=5 scrolldelay=10 align=top
                             bgcolor="#F3F3F4" width="80%" hspace=20 vspace=10 onmouseover=this.stop()
                             onmouseout=this.start()><span style="font-size: 30px">Hi!欢迎使用本系统</span></marquee>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <%--顶部邮箱图标--%>
                    <li class="dropdown">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                            <i class="fa fa-envelope"></i> <span class="label label-warning">16</span>
                        </a>
                        <%--邮箱图标展开--%>
                        <ul class="dropdown-menu dropdown-messages">
                            <li class="m-t-xs">
                                <div class="dropdown-messages-box">
                                    <%--<a href="profile.html" class="pull-left">
                                        <img alt="image" class="img-circle" src="${pageContext.request.contextPath}/static/img/a7.jpg">
                                    </a>--%>
                                    <div class="media-body">
                                        <small class="pull-right">46小时前</small>
                                        <strong>小四</strong> 这个在日本投降书上签字的军官，建国后一定是个不小的干部吧？
                                        <br>
                                        <small class="text-muted">3天前 2014.11.8</small>
                                    </div>
                                </div>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <div class="dropdown-messages-box">
                                    <%-- <a href="profile.html" class="pull-left">
                                         <img alt="image" class="img-circle" src="${pageContext.request.contextPath}/static/img/a4.jpg">
                                     </a>--%>
                                    <div class="media-body ">
                                        <small class="pull-right text-navy">25小时前</small>
                                        <strong>国民岳父</strong> 如何看待“男子不满自己爱犬被称为狗，刺伤路人”？——这人比犬还凶
                                        <br>
                                        <small class="text-muted">昨天</small>
                                    </div>
                                </div>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <div class="text-center link-block">
                                    <a class="J_menuItem" href="mailbox.html">
                                        <i class="fa fa-envelope"></i> <strong> 查看所有消息</strong>
                                    </a>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <%--顶部信息提示图标--%>
                    <li class="dropdown">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                            <i class="fa fa-bell"></i> <span class="label label-primary">8</span>
                        </a>
                        <%--信息提示展开--%>
                        <ul class="dropdown-menu dropdown-alerts">
                            <li>
                                <a href="mailbox.html">
                                    <div>
                                        <i class="fa fa-envelope fa-fw"></i> 您有16条未读消息
                                        <span class="pull-right text-muted small">4分钟前</span>
                                    </div>
                                </a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <a href="profile.html">
                                    <div>
                                        <i class="fa fa-qq fa-fw"></i> 3条新回复
                                        <span class="pull-right text-muted small">12分钟前</span>
                                    </div>
                                </a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <div class="text-center link-block">
                                    <a class="J_menuItem" href="notifications.html">
                                        <strong>查看所有 </strong>
                                        <i class="fa fa-angle-right"></i>
                                    </a>
                                </div>
                            </li>
                        </ul>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="row content-tabs">
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs J_menuTabs">
                <div class="page-tabs-content">
                    <a href="javascript:;" class="active J_menuTab" data-id="index_v1.html">首页</a>
                </div>
            </nav>
            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
            </button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>

                </button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li class="J_tabShowActive"><a>定位当前选项卡</a>
                    </li>
                    <li class="divider"></li>
                    <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                    </li>
                    <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                    </li>
                </ul>
            </div>
            <a href="${pageContext.request.contextPath}/page/logout" class="roll-nav roll-right J_tabExit"><i
                    class="fa fa fa-sign-out"></i> 退出</a>
        </div>
        <div class="row J_mainContent" id="content-main">
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%"
                    src="${pageContext.request.contextPath}/page/welcom" frameborder="0"
                    seamless></iframe>
        </div>
        <div class="footer">
            <div class="pull-right">&copy; 2020 <a href="#" target="_blank">By CV</a>
            </div>
        </div>
    </div>
    <!--右侧部分结束-->
</div>

<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInLeft">
            <div class="modal-header">
                修改头像
            </div>
            <div class="modal-body">
                <input type="file" accept="image/*" id="headImage" placeholder=>
            </div>
            <div class="modal-footer">
                <button id="form-sure" type="button" class="btn btn-primary">确定</button>
                <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="${pageContext.request.contextPath}/static/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/static/js/hplus.js?v=4.1.0"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/contabs.js"></script>

<!-- 第三方插件 -->
<script src="${pageContext.request.contextPath}/static/js/plugins/pace/pace.min.js"></script>

</body>
<script>
    $(function () {
        var hh = 0;
        $("#myModal").modal('hide');
        $("#form-sure").on("click", function () {
            let formData = new FormData();
            formData.append("headImage", $("#headImage")[0].files[0]);
            $.ajax({
                url: '${pageContext.request.contextPath}/user/uploadHeadImage',
                processData: false,
                contentType: false,
                type: 'post',
                dataType: 'json',
                data: formData,
                success: function (data) {
                    if (data.code !== 0) {
                        parent.layer.msg("上传失败", {icon: 2, time: 1000});
                        $("#myModal").modal("hide");
                    } else {
                        $("#headI").attr("src", "${pageContext.request.contextPath}/user/getHeadImage?hh=" + hh);
                        hh++;
                        $("#myModal").modal("hide");
                    }

                }
            })
        });
    });

    function changeHeadImage() {
        $("#myModal").modal("show");
    }

    function notice(op) {
        switch (op) {
            case 0:
                parent.layer.msg("我是${sessionScope.user.userUserName},没其他的了");
                break;
            case 1:
                parent.layer.msg("没有联系方式");
                break;
            case 2:
                parent.layer.msg("没有信箱");
                break;
        }
    }
</script>

</html>
